class MorePhotosForMoreArtistsAndArtworks < ActiveRecord::Migration
  def self.up
    say_with_time "Uploading images..." do
      Picture.create :artwork => Artwork.find_by_name('Tapestry'), :file => File.new(File.join(RAILS_ROOT, 'db', 'migrate', 'files', 'EBJ03_n.jpg')), :media_type => Media::TYPE_PICTURE, :caption => 'test image'
      Picture.create :artwork => Artwork.find_by_name('Yarn painting'), :file => File.new(File.join(RAILS_ROOT, 'db', 'migrate', 'files', 'art_collage.jpg')), :media_type => Media::TYPE_PICTURE, :caption => 'test image'
      Picture.create :artwork => Artwork.find_by_name('Test1'), :file => File.new(File.join(RAILS_ROOT, 'db', 'migrate', 'files', 'weird-sculpt.jpg')), :media_type => Media::TYPE_PICTURE, :caption => 'test image'
      Picture.create :artwork => Artwork.find_by_name('Test2'), :file => File.new(File.join(RAILS_ROOT, 'db', 'migrate', 'files', 'Blue_Film_Sculpture.jpg')), :media_type => Media::TYPE_PICTURE, :caption => 'test image'
      Picture.create :artwork => Artwork.find_by_name('Test3'), :file => File.new(File.join(RAILS_ROOT, 'db', 'migrate', 'files', 'ghostwriter_2.gif')), :media_type => Media::TYPE_PICTURE, :caption => 'test image'
      Picture.create :artwork => Artwork.find_by_name('Test4'), :file => File.new(File.join(RAILS_ROOT, 'db', 'migrate', 'files', 'fehling-peiz.jpg')), :media_type => Media::TYPE_PICTURE, :caption => 'test image'
      Picture.create :artwork => Artwork.find_by_name('Test5'), :file => File.new(File.join(RAILS_ROOT, 'db', 'migrate', 'files', 'theo_jansen_2.jpg')), :media_type => Media::TYPE_PICTURE, :caption => 'test image'
    end
  end

  def self.down
    Picture.delete(Picture.find_by_artwork_id(Artwork.find_by_name('Tapestry').id))
    Picture.delete(Picture.find_by_artwork_id(Artwork.find_by_name('Yarn painting').id))
    Picture.delete(Picture.find_by_artwork_id(Artwork.find_by_name('Test1').id))
    Picture.delete(Picture.find_by_artwork_id(Artwork.find_by_name('Test2').id))
    Picture.delete(Picture.find_by_artwork_id(Artwork.find_by_name('Test3').id))
    Picture.delete(Picture.find_by_artwork_id(Artwork.find_by_name('Test4').id))
    Picture.delete(Picture.find_by_artwork_id(Artwork.find_by_name('Test5').id))
  end
end
